package org.mj.im.common.enums;

public enum IMCmdType {
    LOGIN(0,"登录"),
    HEART_BEAT(1,"心跳"),
    FORCE_LOGOUT(2,"强制下线"),
    PRIVATE_MESSAGE(3,"私聊消息"),
    GROUP_MESSAGE(4,"群发消息")
    ;


    private final int code;
    private final String desc;

    IMCmdType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static IMCmdType getByCode(int code) {
        for (IMCmdType cmdType : values()) {
            if (cmdType.getCode() == code) {
                return cmdType;
            }
        }
        return null;
    }
}
